var _Page, _tools = require("../../../utils/tools.js"), _tools2 = _interopRequireDefault(_tools);

function _interopRequireDefault(e) {
    return e && e.__esModule ? e : {
        default: e
    };
}

function _defineProperty(e, t, o) {
    return t in e ? Object.defineProperty(e, t, {
        value: o,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : e[t] = o, e;
}

var that, app = getApp();

function e(e) {
    return e && e.__esModule ? e : {
        default: e
    };
}

var i = e(require("./modules/base-canvas-palette.js")), n = e(require("../../../utils/wx-promisify/wx-promisify.js")), d = e(require("./modules/handle-create-img.js")), h = ((0, 
n.default)(wx.getSetting), 0), p = 0;

Page((_defineProperty(_Page = {
    data: {
        id: 0,
        indicatorDots: !1,
        vertical: !1,
        autoplay: !0,
        interval: 5e3,
        duration: 1e3,
        isScrollY: !0,
        current: 0,
        isIphoneX: !1,
        isIphone: !1,
        extra_info_tab: 1,
        level: 1,
        p: 1,
        index: 1,
        poster: "",
        is_poster: !1,
        show_poster: !1
    },
    onLoad: function(e) {
        that = this;
    },
    onReady: function() {
        var e = {
            action: "friend",
            contr: "my",
            token: wx.getStorageSync("token")
        };
        wx.showLoading({
            title: "加载中"
        }), _tools2.default.request(e, function(e) {
            that.setData(e.info);
            var t = null;
            wx.createInterstitialAd && e.info.config.screen_ad && ((t = wx.createInterstitialAd({
                adUnitId: e.info.config.screen_ad
            })).onLoad(function() {
            }), t.onError(function(e) {
            }), t.onClose(function(e) {
            }), t.show().catch(function(e) {
                console.error(e);
            }));
        });
    },
    showShare: function() {},
    onUnload: function() {},
    onHide: function() {},
    onShow: function() {}
}, "showShare", function() {
    var e = this.data.config.poster_bg;
    if (this.data.poster) this.setData({
        show_poster: !0
    }); else {
        var t = [ {
            type: "image",
            url: e,
            css: {
                top: "0rpx",
                left: "0rpx",
                width: "540px",
                height: "960px",
                mode: "scaleToFill"
            }
        }, {
            type: "image",
            url: this.data.head,
            css: {
                top: "250px",
                left: "200px",
                width: "140px",
                height: "140px",
                borderRadius: "70px",
                borderWidth: "1px",
                borderColor: "#ffffff"
            }
        }, {
            type: "image",
            url: this.data.qr_code,
            css: {
                top: "655px",
                left: "185px",
                width: "170px",
                height: "170px",
                borderRadius: "85px",
                borderWidth: "1px",
                borderColor: "#ffffff"
            }
        } ];
        this.data.poster = {
            content: t
        }, that.setData({
            is_poster: !0
        }), wx.showLoading({
            title: "正在生成海报",
            mask: !0
        }), d.default.doCreateImg(this);
        try {
            getApp().sensors.track("XMClick", {
                ck_module: "保存海报",
                page: ""
            });
        } catch (e) {}
    }
}), _defineProperty(_Page, "imgErr", function(e) {
    that.setData({
        is_poster: !1
    }), d.default.createImgFail(e);
}), _defineProperty(_Page, "hidePost", function() {
    that.setData({
        show_poster: !1
    });
}), _defineProperty(_Page, "onImgOK", function(e) {
    wx.hideLoading(), that.setData({
        is_poster: !1,
        show_poster: !0,
        poster: e.detail.path
    });
}), _defineProperty(_Page, "preservation", function() {
    wx.saveImageToPhotosAlbum({
        filePath: that.data.poster,
        success: function(e) {
            wx.showToast({
                title: "保存图片成功！",
                icon: "none"
            });
        },
        fail: function(e) {}
    });
}), _defineProperty(_Page, "onShareAppMessage", function() {
    return {
        title: this.data.share.text,
        imageUrl: this.data.share.images,
        path: "bh_rising/pages/newIndex/newIndex?parent_id=" + this.data.share.member_id
    };
}), _Page));